#include <gtest/gtest.h>
#include <thread>
#include <chrono>
#include <pthread.h> // POSIX 线程接口，用于测试中主动取消线程

// 仅用于测试访问私有成员
#define private public
#define protected public
#include "ThreadPool.h"
#undef private
#undef protected

// 设置线程池模式
TEST(ThreadPoolTest, SetMode) {
  ThreadPool pool;
  pool.setMode(PoolMode::MODE_CACHED);

  EXPECT_EQ(pool.poolMode_, PoolMode::MODE_CACHED);
}

// 设置任务队列阈值
TEST(ThreadPoolTest, SetTaskQueueThreshold) {
  ThreadPool pool;
  pool.setTaskQueMaxThreshHold(256);

  EXPECT_EQ(pool.taskQueThreshHold_, 256);
}